package model.util;

public class Factorial {
	private static double i,j;
	
	/**
	 * Method to calculate factorial of @param p and @param l.
	 * 
	 * Edited by E.Kaganov
	 * 
	 * @param p
	 * @param l
	 * @return factorial of parameters
	 */
	public static double getFactorial(int p, int l){
				// ****************** Factorial computation **************************
				double i, j;
				int m;
				if (l == 0)
					return 1;
				if (p > l) {
					m = l;
					l = p;
					p = m;
				}
				i = l + 1;
				for (int k = l + 1; k < p + l; k++)
					i = i * (k + 1);
				j = 1;
				for (int k = 1; k < p; k++)
					j = j * (k + 1);
				return (i / j);
	}
}
